Pro .NET 5 Custom Libraries by Roger Villela

Pro .NET 5 Custom Libraries by Roger Villela

Author:Roger Villela
Language: eng
Format: epub
ISBN: 9781484263914
Publisher: Apress


Operator Overloading: Programming Language Semantics and Syntaxes

When operator overloading is supported by a programming language’s semantics and syntaxes , and the described semantics above are also supported, the ECMA-335 specifies precise semantics for the work of operators, including the name for operator methods.

The required prefix op_ is used as part of the name of the methods for the operators (for example, op_Equality() and op_Inequality()).

The full names of operator methods are also special and defined in ECMA-335.

The ECMA-335 specification includes an “intermediate assembly language”: the MSIL. Here is a necessary distinction. When we write code using a programming language that adheres to the ECMA-335 specification, the result of the compiled code is a sequence of instructions of an MSIL instruction set. These instructions are not for real hardware or processors. Instead, they are for a virtual environment that includes some characteristics and functionalities of the elements in a real computer (exactly what the resources in the ECMA-335 specification describe).

The virtual environment specializations are based on what an advanced operating system has (for example, advanced security rules, mechanisms to constantly observe your own environment, ways to guarantee data integrity based on more flexible or disciplined rules, capacity to recognize contextuality and to be dynamically extensible and expandable, interact with different and specialized environments like data management systems, development system, other platforms and capable of host, and be hosted by other environments.

Remember that this is not a one-to-one mapping between reserved words, data structures, specialized resources, or anything else in programming languages that support the .NET platform. That is, what is formalized through the instructions in MSIL, what is defined by the ECMA-335 specification, and what is implemented by the mechanisms on the platform is what prevails.

Remember that the .NET platform is programming language, operating system, and hardware platform agnostic. So, not every operator is supported by every programming language for the platform. Consult the programming language documentation for details about supported operators.

The following list shows examples of required names for binary operators. When a compiler tool chain generates the MSIL code, the following names should be used:op_Addition for + symbol



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.